import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import enter from '../views/enter.vue'
import index from '@/views/index.vue'

// 你好惠元
import helloIndex from '@/views/hello/index.vue'
import hello from '@/views/hello/hello.vue'
import manager from '@/views/hello/manager.vue'
import charity from '@/views/hello/charity.vue'
import news from '@/views/hello/news.vue'
import newsDetail from '@/views/hello/newsDetail.vue'


// 实力惠元
import strengthIndex from '@/views/strength/index.vue'
import medicine from '@/views/strength/medicine.vue'
import project from '@/views/strength/project.vue'
import doctorsWrap from '@/views/strength/doctorsWrap.vue'
import doctors from '@/views/strength/doctors.vue'
import design from '@/views/strength/design.vue'
import serve from '@/views/strength/serve.vue'



// 幸福惠元
import happiness from '@/views/happiness.vue'

// 梦想惠元
import dream from '@/views/dream.vue'

// 全景惠元
import panorama from '@/views/panorama.vue'


Vue.use(VueRouter)

const routes: Array<RouteConfig> = [

  {
    path: '/',
    name: 'enter',
    component: enter,
    meta: {
      title: '进入页',
      index: 0
    }
  },
  {
    path: '/index',
    name: 'index',
    // 路由懒加载
    component: index,
    meta: {
      title: 'HUIYUAN惠元',
      index: 0,
      scrollToTop: true,
    }
  },



  {
    path: '/hello/index',
    name: 'helloIndex',
    // 路由懒加载
    component: helloIndex,
    meta: {
      title: '你好惠元',
      index: 1,
    },
    children: [
      {
        path: '/hello/hello',
        name: 'hello',
        component: hello,
        meta: {
          title: '你好惠元',
          index: 1,
        }
      },
      {
        path: '/hello/manager',
        name: 'manager',
        component: manager,
        meta: {
          title: '董事寄语',
          index: 1,
        }
      },
      {
        path: '/hello/charity',
        name: 'charity',
        component: charity,
        meta: {
          title: '慈善公益',
          index: 1,
          // keepAlive: true // 需要缓存
        }
      },
      {
        path: '/hello/news',
        name: 'news',
        component: news,
        meta: {
          title: '新闻中心',
          index: 1,
          // keepAlive: true // 需要缓存
        }
      },
      {
        path: '/hello/newsDetail',
        name: 'newsDetail',
        component: newsDetail,
        meta: {
          title: '新闻中心详情',
          index: 1,
          // keepAlive: true // 需要缓存
        }
      },
    ]
  },

  {
    path: '/strength/index',
    name: 'strengthIndex',
    component: strengthIndex,
    meta: {
      title: '实力惠元',
      index: 2,
      // keepAlive: true // 需要缓存
    },
    children: [
      {
        path: '/strength/medicine',
        name: 'medicine',
        component: medicine,
        meta: {
          title: '医学中心',
          index: 2,
          // keepAlive: true // 需要缓存
        }
      },
      {
        path: '/strength/project',
        name: 'project',
        component: project,
        meta: {
          title: '项目体系',
          index: 2,
          // keepAlive: true // 需要缓存
        }
      },
      {
        path: '/strength/doctorsWrap',
        name: 'doctorsWrap',
        component: doctorsWrap,
        meta: {
          title: '名医臻享',
          index: 3,
          // keepAlive: true // 需要缓存
        },
        children: [
          {
            path: '/strength/doctors',
            name: 'doctors',
            component: doctors,
            meta: {
              title: '名医臻享',
              index: 3,
              // keepAlive: true // 需要缓存
            }
          },

          {
            path: '/strength/design',
            name: 'design',
            component: design,
            meta: {
              title: '幸福设计',
              index: 3,
              // keepAlive: true // 需要缓存
            }
          },
          {
            path: '/strength/serve',
            name: 'serve',
            component: serve,
            meta: {
              title: '五心服务',
              index: 3,
              // keepAlive: true // 需要缓存
            }
          },

        ]
      },
    ]
  },


  {
    path: '/panorama',
    name: 'panorama',
    component: panorama,
    meta: {
      title: '全景惠元',
      index: 6,
      // keepAlive: true // 需要缓存
    }
  },






]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
